package cn.wolfcode.mycat.controller;

import cn.wolfcode.mycat.domain.Company;
import cn.wolfcode.mycat.domain.Order;
import cn.wolfcode.mycat.mapper.CompanyMapper;
import cn.wolfcode.mycat.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by wolfcode-lanxw
 */
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderMapper mapper;
    @PostMapping("/save")
    public String save(Order order){
        mapper.insert(order);
        return "保存成功";
    }

    @GetMapping("/list")
    public List<Order> list(int companyId){
        return mapper.selectAll(companyId);
    }
}
